package chapterfour.exceptions;

import java.io.FileReader;
import java.io.IOException;

 
public class Finnaly {

	static int value;
	
	static	{
		
		value=Finnaly.devide(3,2);
	}
	
	
	public static void main(String[] args)  {

		/*Finnaly f=new Finnaly();
		System.out.println(f.value +"dddddddddd");
		 
			System.out.println(devide(3, 3));
			System.out.println(devide(3l, 2l));
			try {
				System.out.println(getIntValue(3));
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
			
			byte b=new Byte("11");
			System.out.println(b);
			*/
		System.out.println(devide(15475, 256));;
	}
	
	
	
	public static void throwWithoutDeclaring(int a ) throws IOException{
		
		try{
			FileReader fr=new FileReader("cgf");
			
			
		}catch(IOException io){
			
			
			throw io;
		}
		
		
	}
	
	
	
	public static int devide(int a,int b) throws RuntimeException{
		//assert(a<b): 11;
		int assert=11;
		return a/b;
	}
	
	
	public static long devide(long a,long b){
		System.out.println("used");
		if(b==0){
			throw new ArithmeticException();
		}
		
		return a/b;
	}
	
	
	public static int getIntValue(Integer a) throws IOException {
		
		if(a==null){
			
			throw new IOException();
		}
		
		return a;
	}
	
}
